package org.msn.server.database;

import org.msn.server.database.impl.MemoryRepositoryImpl;
import org.msn.server.database.impl.RedisRepositoryImpl;

import java.util.Map;

import static org.msn.constant.DatabaseTypeConstant.MEMORY;
import static org.msn.constant.DatabaseTypeConstant.REDIS;

public class DatabaseStrategy {
    public Repository createDatabaseLink(String type, Map<String, Object> info) {
        switch (type) {
            case MEMORY:
                return new MemoryRepositoryImpl(type, info);
            case REDIS:
                return new RedisRepositoryImpl(type, info);
            default:
                return null;
        }
    }
}
